#include "errorlog.h"
#include "QDir"
#include "QDateTime"

ErrorLog::ErrorLog()
{
    this->path = QDir::home().path()+"/default.log";
}

ErrorLog::ErrorLog(QString path)
{
    this->path = path;
}

void ErrorLog::operator <<(QString errStr)
{
    QFile file(path);
    if(file.open(QIODevice::ReadWrite|QIODevice::Append))
    {
        QByteArray byte = errStr.toUtf8();
        file.write(QDateTime::currentDateTime().toString().toUtf8());
        file.write("\n");
        file.write(byte);
        file.write("\n");
        file.close();
    }
}
